package com.example.project_863.controller;

import com.example.project_863.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/record")
public class RecordController {
    @Autowired
    RecordService recordService;
    /**
     *统计设备数量
     * @return
     */
    @RequestMapping("/countRecord/{alarmtype}")
    @ResponseBody
    public Map countRecord (@PathVariable String alarmtype){
        return recordService.countRecord(alarmtype);
    }
    /**
     * 查询报警记录，显示近期40条
     * @return
     */
    @RequestMapping("/findErrorLog")
    @ResponseBody
    public List<Map> findErrorLog(){
        return recordService.findErrorLog();
    }
    @RequestMapping("/findAreaVocs")
    @ResponseBody
    public List<Map> findAreaVocs() {
        return recordService.findAreaVocs();
    }
}
